using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Data;

namespace GiaoDien
{
    class HoaDonDAO
    {
		#region themHoaDon
        public static bool themHoaDon(HoaDonDTO hdDTO)
        {
            string sQuery = "insert into Hoadon(MaHD,Masach,Tensach,Soluong,Thanhtien) values(" + hdDTO.MaHoaDon + "," + hdDTO.MaSach + ",'" +
                hdDTO.TenSach + "','" + hdDTO.SoLuong + "'," + hdDTO.ThanhTien + ")";
            OleDbConnection con = DataProvider.taoKetNoi();
            bool ketqua = DataProvider.executeNonQuery(sQuery, con);
            DataProvider.dongKetNoi(con);
            return ketqua;
        }
        #endregion
		
		#region LayChiTietHoadon
        public static DataTable LayChiTietHoaDon(HoaDonDTO hdDTO)
        {
            string sQuery = "select * from Hoadon order by MaHD";
            OleDbConnection con = DataProvider.taoKetNoi();
            DataTable da = DataProvider.layDataTable(sQuery, con);
            DataProvider.dongKetNoi(con);
            return da;
        }
        #endregion
    }
}
